package com.huahai.service;

import com.huahai.entity.Product;
import com.huahai.service.impl.ProductFallbackFactory;
import com.huahai.service.impl.ProductServiceFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

//声明调用的提供者的name
@FeignClient(value = "service-product",
        //fallback = ProductServiceFallBack.class,
        fallbackFactory = ProductFallbackFactory.class)//调用失败时的处理类
public interface IProductService {

    //指定调用提供者的哪个方法
    //@FeignClient+@GetMapping 就是一个完整的请求路径 http://service-product/product/{pid}
    @GetMapping(value = "/product/{pid}")
    Product findById(@PathVariable("pid") Integer pid);
}
